# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=py3-opencl
_pkgreal=pyopencl
pkgver=2023.1.4
pkgrel=0
pkgdesc="Python3 wrapper for OpenCL"
url="https://pypi.org/project/pyopencl"
arch="all"
license="MIT"
depends="py3-platformdirs py3-numpy py3-mako py3-pytools"
makedepends="
	libffi-dev
	mesa-dev
	opencl-dev
	py3-gpep517
	py3-numpy-dev
	py3-pybind11-dev
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="py3-pytest py3-py"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgreal:0:1}/$_pkgreal/$_pkgreal-$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"
options="!check" # tests require python-theano which isn't packed yet

replaces="py-opencl" # Backwards compatibility
provides="py-opencl=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
2508d21856d9b846bce14bcd11d007eedddc1cc5c1ce9f8d2ac18743ab9aa5d673c85792b535779b2f414caf47e39ed53c07d7ee8a061bcfa020a15f59463861  pyopencl-2023.1.4.tar.gz
"
